package com.zmn.mcc.listener;

import com.zmn.manager.mq.annotation.AliyunMQHandler;
import com.zmn.manager.mq.annotation.AliyunMQListener;
import com.zmn.mcc.business.interfaces.staff.StaffBService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * <h>
 * IP不限制日期的钉钉流程结果监听
 * </h>
 * <p>
 * 关于topic：
 * 测试环境：test2_zmn_dove
 * 生产环境：zmn_dove
 * </p>
 *
 * @author xyh
 * @version v1.0
 * @since 2022/8/11 12:57
 **/
@AliyunMQListener(topic = "${spring.mq.topic.dove}")
@Component
@Slf4j
public class IpOpenDateListener {

    @Resource
    private StaffBService staffBService;

    /**
     * 不限ip流程mq的tag
     */
    private static final String DING_TALK_AUDIT_PROCESS_MCC_TAG = "dingTalk_audit_process_mcc";


    /**
     * <p>
     * 流程结束之后获取到流程实例id，然后去查流程实例详情。然后设置员工不限制ip日期
     * </p>
     * 2022/08/01 00:00:00 - 2022/08/11 23:59:59
     *
     * @param message 不限ip流程mq
     */
    @AliyunMQHandler(tags = DING_TALK_AUDIT_PROCESS_MCC_TAG)
    public void handle(String message) {
        staffBService.dealIpOpenDate(message);
    }


}
